import React from "react";
import './index.css';
import PublishOrder from "../PublishOrder";
import Transaction from "../Transaction";
import HireService from "../HireService";

export default class extends React.Component{
    constructor(props){
        super();
        this.state={
            type:props.type
        }
    }

    UNSAFE_componentWillReceiveProps(props){
        this.setState({
            type:props.type

        })
    }
    
    // 发布派单入口
    render(){
        let suspension="";
        switch(this.state.type){
            case "MyPublish":
                suspension=<PublishOrder text="发布派单" subtext="RELEASE LIST"/>
                break;
            case "TransactionBill":
                suspension=<Transaction text="发布派单" subtext="RELEASE LIST"/>
                break;
            case "TradeDistribure":
                suspension=<HireService  text="我要发布" subtext="I want to release."/>
                break;
            default:
                break;
        }
        return(suspension)
    }
}